﻿using DataSharing.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DataSharing.Controllers
{
    public class SharerController : Controller
    {
        public ActionResult List()
        {
            var list = new List<StudentInfo>
            {
                new StudentInfo{Id="SV001", Name="Nguyễn Thị Minh Khai", Marks=10},
                new StudentInfo{Id="SV002", Name="Lý Tự Trọng", Marks=9},
                new StudentInfo{Id="SV003", Name="Phạm Thế Hiển", Marks=5}
            };
            return View(list);
        }
        //
        // GET: /Sharer/
        public ActionResult Index()
        {
            ViewBag.Id = "SV001";
            ViewBag.Name = "Nguyễn Minh Tuấn";
            ViewData["Marks"] = 9.5;

            ViewBag.Student = new StudentInfo
            {
                Id = "SV002",
                Name = "Phạm Tuấn Kiệt",
                Marks = 8.6
            };

            var model = new StudentInfo
            {
                Id = "SV003",
                Name = "Võ Thị Sáu",
                Marks = 9.2
            };

            return View(model);
        }
	}
}